import java.util.LinkedList;
import java.util.Queue;
//用俩个队实现栈
public class MyStack {
    private Queue<Integer> qu1 = new LinkedList<>();
    private Queue<Integer> qu2 = new LinkedList<>();


    }
    public void push(int x){//儒道不为空的站，都为空默认到qu1
    if(!qu1.isEmpty()){
        qu1.offer(x);
    }else if(!qu1.isEmpty()){
        qu2.offer(x);

    }else {
        qu1.offer(x);
    }

    }
    public  boolean empty(){//俩个队列都为空
        return  qu1.isEmpty()&&qu2.isEmpty();
    }
    public  int pop(){
        if(empty()){
            return -1;//栈为空
        }
        int tmp=-1;
        if(!qu1.isEmpty()){
            int size=qu1.size();
            for (int i = 0; i < size; i++) {
                tmp=qu1.poll();
                qu2.offer(tmp);
            }
            return tmp;
        }else{
            int size=qu2.size();
            for (int i = 0; i < size; i++) {
                tmp=qu2.poll();
                qu1.offer(tmp);
            }
            return tmp;
        }

    }
}
